﻿using Microsoft.EntityFrameworkCore;

namespace Devonline.AspNetCore;

/// <summary>
/// 业务数据带附属集合及附加信息类数据处理的基础数据服务
/// 不提供一次性新增或修改所有附属集合的功能, 因为不明确附属集合类型的数量, 实际业务中需要的时候调用即可
/// 一个业务数据中仅有一个类型为: TAdditional 的附加信息集合
/// </summary>
/// <typeparam name="TDbContext">数据库上下文</typeparam>
/// <typeparam name="TEntitySet">业务数据类型</typeparam>
/// <typeparam name="TElement">集合元素数据类型</typeparam>
/// <typeparam name="TAdditional">附加信息数据类型</typeparam>
/// <typeparam name="TKey">主键类型</typeparam>
public interface IDataWithCollectionAndAdditionalService<TDbContext, TEntitySet, TElement, TAdditional, TKey> :
    IDataWithCollectionService<TDbContext, TEntitySet, TElement, TKey>,
    IDataWithAdditionalService<TDbContext, TEntitySet, TAdditional, TKey>,
    IDataService<TDbContext, TEntitySet, TKey>,
    IDataCollectionService<TDbContext, TEntitySet, TElement, TKey>,
    IDataAdditionalService<TDbContext, TEntitySet, TAdditional, TKey>
    where TDbContext : DbContext
    where TEntitySet : class, IEntitySet<TKey>
    where TElement : class, IEntitySet<TKey>
    where TAdditional : class, IAdditional<TKey>
    where TKey : IConvertible
{ }

/// <summary>
/// 业务数据带附属集合及附加信息类数据处理的基础数据服务
/// 字符串作为主键的默认实现
/// 不提供一次性新增或修改所有附属集合的功能, 因为不明确附属集合类型的数量, 实际业务中需要的时候调用即可
/// 一个业务数据中仅有一个类型为: TAdditional 的附加信息集合
/// </summary>
/// <typeparam name="TDbContext">数据库上下文</typeparam>
/// <typeparam name="TEntitySet">业务数据类型</typeparam>
/// <typeparam name="TAdditional">附加信息数据类型</typeparam>
public interface IDataWithCollectionAndAdditionalService<TDbContext, TEntitySet, TElement, TAdditional> :
    IDataWithCollectionAndAdditionalService<TDbContext, TEntitySet, TElement, TAdditional, string>,
    IDataWithCollectionService<TDbContext, TEntitySet, TElement>,
    IDataWithAdditionalService<TDbContext, TEntitySet, TAdditional>,
    IDataService<TDbContext, TEntitySet>,
    IDataCollectionService<TDbContext, TEntitySet, TElement>,
    IDataAdditionalService<TDbContext, TEntitySet, TAdditional>
    where TDbContext : DbContext
    where TEntitySet : class, IEntitySet<string>
    where TAdditional : class, IAdditional<string>
    where TElement : class, IEntitySet<string>
{ }